{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Configuration of 4G EPC of Open Air Interface (OAI) with multiple eNBs \n",
    "---\n",
    "### Objectives\n",
    "- Configure multiple OAI eNBs 📡 - 📡\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Multiple eNB Configuration\n",
    "\n",
    "---\n",
    "\n",
    "At the end of a set of three hands-on (this is the first one), the goal is to run the simulated OAI scenario, which consists of the 4G core (EPC), eNB1 in Docker, eNB2 rfsim and user equipment (UE), according to the image below:\n",
    "\n",
    "![multiple_eNB_config_](../FIGS/H04_4G_EPC_UNI_III/4G_EPC_deploy_eNB2.png)\n",
    "\n",
    "---\n",
    "\n",
    "To connect multiple eNBs, follow the steps below in a new Linux Terminal:\n",
    "\n",
    "#### Step 1: \n",
    "Make a copy of the configuration file used to connect the first gNB: \n",
    "\n",
    "```bash\n",
    "cd /home/dco1020/openairinterface5g/ci-scripts/conf_files\n",
    "sudo cp enb.band7.25prb.rfsim.conf ./enb2.band7.25prb.rfsim.conf\n",
    "```\n",
    "\n",
    "⚠️ **Attention:** You must change the file name, in the example above \"enb.band7.25prb.rfsim.conf\".\n",
    "___\n",
    "####  Step 2:\n",
    "\n",
    "Open file by typing:\n",
    "\n",
    "```bash\n",
    "gedit /home/dco1020/openairinterface5g/ci-scripts/conf_files/enb2.band7.25prb.rfsim.conf\n",
    "```\n",
    "\n",
    "⚠️ **Attention:** The name in \"Active_eNBs\" has to be the same as the parameter \"eNB_name\", in the example of the figure above \"eNB2-oai\".\n",
    "\n",
    "⚠️ **Attention:** To connect other eNBs, simply repeat the steps, always entering different names and IDs for each eNB.\n",
    "\n",
    "⚠️ **Attention:** In the deployment stage, it will be necessary to deploy each gNB separately, on different Linux terminals, simply by changing the file used in the deploy command.\n",
    "\n",
    "Change eNB parameters\n",
    "\n",
    "This part you will change the eNB name and ID in (/home/dco1020/openairinterface5g/ci-scripts/conf_files/enb2.band7.25prb.rfsim.conf), such as in figure below.\n",
    "\n",
    "![multiple_eNB_config_](../FIGS/H04_4G_EPC_UNI_III/multiple_eNB_config.png)\n",
    "\n",
    "It is also necessary to change the IP of the new eNB's interfaces. To do this, check the host's IP using the `ifconfig` command, then enter the IPs in the fields as shown in the following image.\n",
    "\n",
    "![multiple_eNB_config_](../FIGS/H04_4G_EPC_UNI_III/4G_EPC_eNB2_network.png)\n",
    "\n",
    "After changing the information, save the file.\n",
    "\n",
    "___\n",
    "#### Step 3:\n",
    "Open another terminal using crtl+Alt+T and type:\n",
    "\n",
    "```bash\n",
    "sudo su\n",
    "cd /home/dco1020/openairinterface5g/cmake_targets/ran_build/build/\n",
    "sudo -E ./lte-softmodem --rfsim -O ../../../ci-scripts/conf_files/enb2.band7.25prb.rfsim.conf\n",
    "```\n",
    "\n",
    "![multiple_eNB_config_](../FIGS/H04_4G_EPC_UNI_III/multiple_eNB_config2.png)\n",
    "\n",
    "---\n",
    "\n",
    "🚩 - If you want to deploy the OAI eNB dashboard follow this tutorial: [OAI eNB dashboard](https://github.com/vicentesousa/PPGEEC_2333/blob/main/howtos/H02_5G_OAI_dashboard.ipynb)."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
